﻿/*
(c) 2010 - Open Source Business Foundation e. V. (www.osbf.de)
This software is provided under Microsoft Reciprocal License (Ms-RL)
(http://www.microsoft.com/opensource/licenses.mspx#Ms-RL)
All other rights reserved
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;

namespace MicroFormatProcessing
{

    /// <summary>
    /// Tag DB Stuff
    /// </summary>
    

    public class TagContext : TableServiceContext
    {
        public const string TABLE_NAME = "Tags";

        public TagContext(string baseAdress, StorageCredentials storageCredentials) : base(baseAdress, storageCredentials)
        {
        }

        public IQueryable<Tag> Tags
        {
            get
            {
                return this.CreateQuery<Tag>(TABLE_NAME);
            }
        }

        public void Add(Tag tag)
        {
            this.AddObject(TABLE_NAME, tag);
        }

        public void Update(Tag tag)
        {
            this.UpdateObject(tag);
        }

        public void Delete(Tag tag)
        {
            this.DeleteObject(tag);
        }

        public void AttachTo(Tag tag)
        {
            this.AttachTo(TABLE_NAME, tag);
        }
    }
}